package Testdmo3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-03-16
 * Time：9:37
 */
public class J3_16 {

    public static String setstring (String str) {
        // write code here

        String s=new String("");
        int []array=new int[200000];
        for(int i=0;i<str.length();i++) {
            char ch=str.charAt(i);
            array[ch]++;

            if(array[ch]==1) {
                s+=ch;
            }
        }


        System.out.println(s);
        return s;
    }

    public static String toLowerCase(String s) {

        String s1=new String("");
        for(int i=0;i<s.length();i++) {
            char ch=s.charAt(i);
            if (Character.isLetter(ch) && Character.isUpperCase(ch)) {
                s1+=Character.toLowerCase(ch);
            } else {
                s1+=ch;
            }
        }

        return s1;

    }

    class Solution {
        public int countSegments(String s) {

            int count=0;
            String[]s1=s.split(" ");

            for (String s2:s1) {
                if (s2.length() != 0) {
                    count++;
                }
            }

            return count;


        }
    }
    public static void main(String[] args) {

    }
}
